<?php
global $wpdb;
$url = get_bloginfo('home')."/wp-admin/admin.php?page=tour-setting&action=tour-booked&update=";
$order = db_select_data_by_int("orders", "ID", $view);
$customerID	= $order[0]->customerID;
$itemID	= $order[0]->itemID;
$paymentID  = $order[0]->paymentID;

$customers = db_select_data_by_int("customers", "ID", $customerID); 

$tour = db_select_data_by_int("tours", "ID", $itemID); 
$payment = db_select_data_by_int("payments", "ID", $paymentID);

// bo dem trong admin : order da duoc xem chua
$option = 'order_'.$order[0]->ID;
update_option($option, 1);

?>
<div class="view-booking-detail">
	<h1>Tour Booked Infomation</h1>
	<table>
		<tr>
			<td class="booked-title">Booked ID</td>
			<td class="booked-item"><span><?php echo $order[0]->ID;?></span></td>
			
			<td class="booked-title">Date</td>
			<td class="booked-item"><span><?php echo $order[0]->date;?></span></td>
		</tr>
		<tr>
			<td class="booked-title">Order Status</td>
			<td class="booked-item"><span><?php echo $order[0]->orderStatus;?></span></td>
			<td class="booked-title">Payment Status</td>
			<td class="booked-item"><span><?php echo $payment[0]->paymentStatus;?><?php echo ' - '.$payment[0]->paymentMethod;?></span></td>
		</tr>		
		<tr>
			<td class="booked-title">Tour</td>
			<td class="booked-item"><span><?php echo get_the_title($tour[0]->tourID);?></span></td>			
		</tr>
		<tr>
			<td class="booked-title">Destination From</td>
			<td class="booked-item"><span><?php echo get_post_meta($tour[0]->tourID, $wpdb->prefix.'destination_from',true);?></span></td>
			
			<td class="booked-title">Destination To</td>
			<td class="booked-item"><span><?php echo get_post_meta($tour[0]->tourID, $wpdb->prefix.'destination_to',true);?></span></td>
		</tr>
		
		<tr>
			<td class="booked-title">Lenght of Day</td>
			<td class="booked-item"><span><?php echo get_post_meta($tour[0]->tourID, $wpdb->prefix.'lenght_of_stay',true);?></span></td>
			
			<td class="booked-title">Trevel in party of</td>
			<td class="booked-item"><span><?php echo $tour[0]->travelInpartof;?> Person</span></td>
		</tr>
	
		<tr>
			<td class="booked-title">Propose date of tour</td>
			<td class="booked-item"><span><?php echo $tour[0]->proposeDate;?></span></td>
			
			<td class="booked-title">Tour Type</td>
			<td class="booked-item"><span><?php echo $tour[0]->typeTour;?></span></td>
		</tr>
		<tr>
			<td class="booked-title">Tour Price</td>
			<td class="booked-item"><span><?php echo $payment[0]->price;?> USD</span></td>
			
			<td class="booked-title">Deposit</td>			
			<td class="booked-item"><span><?php echo $payment[0]->paymentCurrent;?> USD</span></td>
		</tr>
		
		<tr>
			<td class="booked-title"></td>
			<td class="booked-item"><h2>Customer Infomation</h2></td>
		</tr>
		<tr>
			<td class="booked-title">Customer Name</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerName;?></span></td>
			
			<td class="booked-title">Customer Address</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerAddress;?></span></td>
		</tr>
		
		<tr>
			<td class="booked-title">Customer Email</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerEmail;?></span></td>
			
			<td class="booked-title">Customer Phone</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerPhone;?></span></td>
		</tr>
		<!-- 
		<tr>
			<td class="booked-title">Customer Fax</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerFax;?></span></td>
		</tr>
		-->
		<tr>
			<td class="booked-title">Customer Comment</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerComment;?></span></td>
		</tr>
		<tr>
			<td class="booked-title"></td>
			<td class="booked-item"></td>
		</tr>
		<tr>
			<td class="booked-title"></td>
			<td class="booked-item">
				<a id="update_button" href="<?php echo $url;?><?php echo $order[0]->ID;?>">Update</a>
			</td>
		</tr>
		<tr>
			<td class="booked-title"></td>
			<td class="booked-item"></td>
		</tr>
	</table>		
</div>
